<!-- 主会场 -->
<template>
	<view class="content">
		<view  class="my-service-title" @click="handleNavBarBack">
			<uv-icon name="arrow-left" size="22" color="#fff"></uv-icon>
		</view>
		<image class="imgView" v-for="(item,index) in list" :key="index" :src="item" mode="widthFix"></image>
	</view>
</template>

<script setup>
	import {onLoad, onShow, onHide } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	
	const list = ref([
		'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/主会场/主会场_01.webp',
		'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/主会场/主会场_02.webp',
		'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/主会场/主会场_03.webp',
		'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/主会场/主会场_04.webp',
	])
	
	// 返回
	const handleNavBarBack = () => {
		uni.navigateBack();
	}
	
	//分享函数
	const getWin =  async () => { 
		 const currentUrl = 'https://www.yunyakeji.top/';
		
		 // 请求后端获取签名配置
		const res = await vk.callFunction({
			url: 'client/token/pub/index',
			data: { url: currentUrl } // 传递当前URL
		});
		
		const config = res;
		console.log('config',config)
		// 初始化微信SDK
		jWeixin.config({
			debug: false,
			appId: config.appId,
			timestamp: config.timestamp,
			nonceStr: config.noncestr,
			signature: config.signature,
			jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData','onMenuShareAppMessage','onMenuShareTimeline']
		});
		
		jWeixin.ready(() => {
		    // 自定义“分享给朋友”
			 const shareConfig = {
				title: '2025天津市第四届海河肺癌诊疗新进展学术会议',
				desc: '会议日期：6月21日～22日，会议场地：天津梅江中心皇冠假日酒店', // 分享描述
				link: currentUrl, // 使用当前URL
				imgUrl: 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/WechatIMG192.webp', // 分享图标
			};
			
		    jWeixin.updateAppMessageShareData(shareConfig);
		
		    // 自定义“分享到朋友圈”
		    jWeixin.updateTimelineShareData(shareConfig);
			
			// 兼容旧版API
			  jWeixin.onMenuShareAppMessage(shareConfig);
			  
			  jWeixin.onMenuShareTimeline(shareConfig);
		});
		
		jWeixin.error(err => {
			console.error('微信SDK初始化失败', err);
		});
	}
	
	onLoad(() => {
		getWin()
	})
	
</script>

<style scoped lang="scss">
	.content {
		width: 100vw;
		max-width: 750px;
		min-height: 100vh;
		background: no-repeat center bottom;
		background-size: auto 100%;
		box-sizing: border-box;
		position: relative;
		display: block;
		margin: 0 auto;
		background-color: #f9fafb;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		
		.my-service-title {
			width: 54rpx;
			height: 54rpx;
			background: rgba(24, 31, 67, 0.8);
			border-radius: 16rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			position: fixed;
			top: 30rpx;
			left: 30rpx;
			z-index: 99;
		}
		
		.imgView{
			width: 100%;
			height: auto;
			margin-top: -1px;
		}
	}
</style>